package com.examples.image;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class ImageBasic{
	
	
	public static void main(String[] args) {
		Display d = Display.getDefault();
		Shell s = new Shell(d);
		s.setBounds(0, 0, 250, 300);
		final Image image = new Image(d, "images.jpg");
		image.type = SWT.BITMAP;
		
		s.addPaintListener(new PaintListener() {
			@Override
			public void paintControl(PaintEvent e) {
			e.gc.drawImage(image, 0, 0);
			}
		});
		
		s.open();
		while (!s.isDisposed()) {
			if (!d.readAndDispatch())
				d.sleep();
		}
		
	}
}